import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'index',
    redirect: '/orderSearch',
    meta: {
      title: '宜春惠民保',
    },
  },
  {
    path: '/orderSearch',
    name: 'orderSearch',
    component: () => import("@/views/orderSearch/orderSearch"),
    meta: {
      title: '宜春惠民保',
    },
  },
  {
    path: '/orderSearchList',
    name: 'orderSearchList',
    component: () => import("@/views/orderSearchList/orderSearchList"),
    meta: {
      title: '订单列表',
    },
  },
  {
    path: '/orderSearchDetail',
    name: 'orderSearchDetail',
    component: () => import("@/views/orderSearchDetail/orderSearchDetail"),
    meta: {
      title: '订单详情',
    },
  },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

router.afterEach((to: any, form: any) => {
  document.title = to.meta?.title || '';
})

export default router;
